package com.letoken.platform.repo.app.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.letoken.platform.repo.app.po.AppWithdrawConfig;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 作者
 * @since 2024-05-22
 */
public interface AppWithdrawConfigMapper extends BaseMapper<AppWithdrawConfig> {
    @Select("select user_id from app_withdraw_config")
    List<Integer> getListUserId();

    @Select("select level from app_user_team where user_id=#{userId}")
    Integer getLevel(@Param("userId") Integer userId);

    @Select({
            "<script>",
            "select * from app_withdraw_config",
            "<if test='null != userId'>" ,
            "  where user_id = #{userId}",
            "</if>" ,
            "</script>"
    })
    Page<AppWithdrawConfig> page(@Param("page") Page<AppWithdrawConfig> page, @Param("userId") Integer userId);


}
